class Solution {
    public int singleNonDuplicate(int[] nums) {
        int left = 0;
        int rigth = nums.length - 1;
        int a = 0;
        while(left < rigth) {
            a = a ^ nums[left];
            a = a ^ nums[rigth];
            left++;
            rigth--;
        }
        if(left == rigth) {
            a = a ^ nums[left];
        }
        return a;
    }
}